<template>
    <div id="signin">
        <div class="mask">
            <el-input
            v-model='userInfo.accountName'
            >
            </el-input>
             <el-input
             v-model='userInfo.password'
             type=password>
            </el-input>
            <el-button
            type="primary"
            @click='signin'
            >
                登录
            </el-button>
        </div>
    </div>    
</template>
<script>
export default {
    data(){
        return {
            userInfo:{
                accountName:'zmt',
                password:'12345'
            },
        }
    },
    methods:{
        signin(){
            this.$http.post(this.$apis.signin,this.userInfo)
            .then((resp)=>{
                if(resp.data.token){
                    console.log(resp.data.token)
                    localStorage.setItem('response',JSON.stringify(resp.data.response))
                    localStorage.setItem('token',resp.data.token)
                if(this.$route.query.redirect){
                    this.$router.push(this.$route.query.redirect);
                }else{
                    this.$router.push('/Home')
                }
                }
                console.log(resp)
                return resp;
            })
        }
    }
}
</script>
<style lang="scss" scoped>
    #signin{
        position:absolute;
        top: 0;
        right:0;
        bottom: 0;
        left:0;
        .mask{
            width:40%;
            height:30%;
            background: lightblue
        }
        }
</style>
